home *** CD-ROM | disk | FTP | other *** search
- /*
- ** DELETE.C [edit EMAIL.H before compiling]
- **
- ** This program deletes the specified email
- ** message on the SMTP server.
- */
-
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "see.h"
- #include "email.h"
-
- static char Buffer[512];
-
- void ErrorExit(int Code)
- {seeErrorText(Code,(LPSTR)Buffer,512);
- printf("SEE Error %d: %s\n", Code, Buffer);
- seeClose();
- exit(1);
- }
-
- void main(int argc, char *argv[])
- {int i;
- int Code;
- int MsgNbr1;
- int MsgNbr2;
- if(argc!=3)
- {printf("Usage: DELETE <MsgNbr1> <MsgNbr2>\n");
- exit(1);
- }
- MsgNbr1 = atoi(argv[1]);
- MsgNbr2 = atoi(argv[2]);
- if(MsgNbr1>MsgNbr2)
- {printf("Msg %d must be less than Msg %d\n",MsgNbr1,MsgNbr2);
- exit(1);
- }
- if(MsgNbr1<1)
- {printf("MsgNbr1 = %d too small\n", MsgNbr1);
- exit(1);
- }
-
- /* define diagnostics log file */
- ///seeStringParam(SEE_LOG_FILE, (LPSTR)"delete.log");
- /* connect to POP3 server */
- printf("Connecting to %s ...",(LPSTR)POP3_HOST_NAME);
- Code = seePop3Connect(
- (LPSTR)POP3_HOST_NAME,
- (LPSTR)POP3_USER_NAME,
- (LPSTR)POP3_PASSWORD);
- if(Code>=0) printf("OK\n");
- else ErrorExit(Code);
- /* delete message(s) */
- for(i=MsgNbr2;i>=MsgNbr1;i--)
- {printf("Deleting message %d...\n",i);
- Code = seeDeleteEmail(i);
- if(Code<0) ErrorExit(Code);
- }
- seeClose();
- } /* end main */
-
-
-